import 'package:flutter/material.dart';
import 'package:untitled/chat_page.dart';
import 'package:untitled/discover_page.dart';
import 'package:untitled/friend_page.dart';
import 'package:untitled/mine_page.dart';

class myHome extends StatefulWidget {
  const myHome({super.key});

  @override
  State<myHome> createState() => _myHomeState();
}

class _myHomeState extends State<myHome> {
  // @override
  // Widget build(BuildContext context) {
  //   return const Placeholder();
  // }
  int _currentIndex = 0;
  List <Widget> _pages = [Chatpage(),discover_page(),firend_page(),mine_page()];
  @override
  Widget build(BuildContext context){
    return  Container(
      color: Colors.green,
      child: Scaffold(
        body: _pages[_currentIndex],
        bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          fixedColor: Colors.green,
          currentIndex: _currentIndex,
          onTap: (index){
            setState(() {
              _currentIndex = index;
            });
          },
          items:const [
            BottomNavigationBarItem(icon: Icon(Icons.chat),label: '聊天'),
            BottomNavigationBarItem(icon: Icon(Icons.bookmark),label: '列表'),
            BottomNavigationBarItem(icon: Icon(Icons.history),label: '列表'),
            BottomNavigationBarItem(icon:Icon(Icons.ice_skating), label: '列表')
          ],

        ),
      ),
    );
  }
}
